<?php

namespace App\Http\Controllers\Admin;

use App\Exceptions\BasicException;
use App\Response\Response;
use App\Http\Controllers\BaseController;
use Illuminate\Http\Request;                //引用http请求类

class RoomPkController extends BaseController
{
    /**
     * Notes:房间pk 列表
     * User: wangyueli
     *
     * @param  Request  $request
     * @return string
     */
    public function list(Request $request)
    {
        $list = app('repo_room_pk')->list($request->all());
        return Response::sendList($list);
    }

    /**
     * Notes:房间pk 详情
     * User: wangyueli
     *
     * @param  Request  $request
     * @return string
     * @throws BasicException
     */
    public function info(Request $request)
    {

        $param = $request->all();
        $v = app('validator')->make($param, [
            'id' => 'required',
        ]);
        if ($v->fails()) throw new BasicException(0, $v->errors()->first());

        $id = $request->input('id', 0);

        $info = app('repo_room_pk')->info($id);
        return Response::sendData($info);
    }
}
